package com.apexsoft.monitor.front.console.magent.controller;

import com.alibaba.fastjson.JSONObject;
import com.apexsoft.front.common.support.BaseFrontController;
import com.apexsoft.monitor.front.console.magent.service.MagentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller("magentController")
@RequestMapping("/console/magent")
public class MagentController extends BaseFrontController {
    @Autowired
    @Qualifier("magentService")
    private MagentService magentService = null;


    /**
     * 获取主机上部署的监控程序是否正常
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getHostInfo")
    public String getHostMagentStatus(HttpServletRequest request, HttpServletResponse response) throws Exception {
        JSONObject result = magentService.getHostStatus();
        this.printJSON(response,result);
        return null;
    }

}
